﻿namespace First_WebAPI.MiddleWares
{
    public class Test1MiddleWare
    {
        public readonly RequestDelegate next;

        public Test1MiddleWare(RequestDelegate next)
        {
            this.next = next;
        }
        public async Task InvokeAsync(HttpContext context)
        {
            //await context.Response.WriteAsync("执行前置中间件");
            //执行下一个中间件，并将上下文对象context传入到下一个中间件
            await next.Invoke(context);
            //await context.Response.WriteAsync("执行后置中间件");
        }
    }
}
